package com.wise.site.detail;

import com.wise.site.R;
import com.wise.site.adapter.CommentAdapter;
import com.wise.site.utils.Constanct;
import com.wise.site.widget.PullRefenceList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class DetailCommentActivity extends Activity implements View.OnClickListener {
	private PullRefenceList mCommentListView;
	private CommentAdapter mCommentAdapter;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.detail_comment_activity);
		
		Intent intent = getIntent();
		int id = intent.getIntExtra(Constanct.INFO_ENTRY, -1);
		int type = intent.getIntExtra(Constanct.INFO_TYPE, -1);
		String title = intent.getStringExtra(Constanct.INTENT_TITLE);
		String subTitle = intent.getStringExtra(Constanct.INTENT_SUB_TITLE);
		
		
		((TextView)findViewById(R.id.activity_title)).setText(R.string.comment_browse);
		((TextView)findViewById(R.id.info_title)).setText(title);
		((TextView)findViewById(R.id.info_sub_title)).setText(subTitle);
		
		findViewById(R.id.title_back).setOnClickListener(this);
		
		mCommentListView = (PullRefenceList) findViewById(R.id.comment_list);
		mCommentAdapter = new CommentAdapter(this);
		mCommentAdapter.setListView(mCommentListView);
		mCommentAdapter.setSubjectId(id);
		mCommentAdapter.setType(type);
		mCommentAdapter.moveToFristPage();
		mCommentAdapter.loadData();
	}
	
	@Override
	public void onClick(View v) {
		Intent intent = new Intent();
		int id = v.getId();
		switch(id){
		case R.id.title_back:
			finish();
			break;
		case R.id.share_img:
			intent.setClass(this, DetailShareActivity.class);
			startActivity(intent);
			break;
		case R.id.collect_img:
			//收藏商铺
			//comm
			break;
		}
	}

}
